#!/usr/bin/python

import time, sys
from math import sqrt, ceil, floor

""" 
The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?
"""
def isprime(num):
    ans = True
    for n in xrange(2, int(ceil(sqrt(num)))+1):
        if num % n == 0:
            ans = False
            break

    return ans


def main():
    start = time.time()
    num = 600851475143
    
    for n in reversed(xrange(num):
        if isprime(n):
            if num % n == 0:
                break
            
    print n
    
    print '{0:.2f} s'.format(time.time() - start)        

# solution: 

if __name__ == '__main__':
  main()
